package com.link2room.aeriabots.entity;

import com.link2room.common.entity.BaseEntity;
import org.hibernate.annotations.DynamicInsert;

import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.util.Date;

/**
 * Created by Nakisa on 2016/9/2.
 */
@Entity
@DynamicInsert
@Table(name = "wx_certificate")
public class WxCertificate extends BaseEntity{
    private String appid;
    private String appAliasName;
    private String appSecret;
    private String wxMchId;
    private String wxPayKey;
    private String certLocalPath;
    private String certPassword;
    private String accessToken;
    private String refreshToken;
    private String jspTicket;
    private Date refreshDate;
    public WxCertificate(){

    }
    public WxCertificate(String lhotelGroupCode,String lhotelCode){
        setLhotelCode(lhotelCode);
        setLhotelGroupCode(lhotelGroupCode);
    }
    public WxCertificate(String appid){
        setAppid(appid);
    }
    @Basic
    @Column(name = "appid", nullable = false, length = 64)
    public String getAppid() {
        return appid;
    }

    public void setAppid(String appid) {
        this.appid = appid;
    }
    @Basic
    @Column(name = "app_alias_name", nullable = true, length = 32)
    public String getAppAliasName() {
        return appAliasName;
    }

    public void setAppAliasName(String appAliasName) {
        this.appAliasName = appAliasName;
    }

    @Basic
    @Column(name = "app_secret", nullable = true, length = 64)
    public String getAppSecret() {
        return appSecret;
    }

    public void setAppSecret(String appSecret) {
        this.appSecret = appSecret;
    }

    @Basic
    @Column(name = "wx_mchID", nullable = true, length = 64)
    public String getWxMchId() {
        return wxMchId;
    }

    public void setWxMchId(String wxMchId) {
        this.wxMchId = wxMchId;
    }
    @Basic
    @Column(name = "wx_pay_key", nullable = true, length = 64)
    public String getWxPayKey() {
        return wxPayKey;
    }

    public void setWxPayKey(String wxPayKey) {
        this.wxPayKey = wxPayKey;
    }

    @Basic
    @Column(name = "access_token", nullable = true, length = 255)
    public String getAccessToken() {
        return accessToken;
    }

    public void setAccessToken(String accessToken) {
        this.accessToken = accessToken;
    }

    @Basic
    @Column(name = "refresh_token", nullable = true, length = 255)
    public String getRefreshToken() {
        return refreshToken;
    }

    public void setRefreshToken(String refreshToken) {
        this.refreshToken = refreshToken;
    }
    @Basic
    @Column(name = "cert_local_path", nullable = true, length = 128)
    public String getCertLocalPath() {
        return certLocalPath;
    }

    public void setCertLocalPath(String certLocalPath) {
        this.certLocalPath = certLocalPath;
    }
    @Basic
    @Column(name = "cert_password", nullable = true, length = 128)
    public String getCertPassword() {
        return certPassword;
    }

    public void setCertPassword(String certPassword) {
        this.certPassword = certPassword;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        WxCertificate that = (WxCertificate) o;

        if (appid != null ? !appid.equals(that.appid) : that.appid != null) return false;
        if (appSecret != null ? !appSecret.equals(that.appSecret) : that.appSecret != null) return false;
        if (wxMchId != null ? !wxMchId.equals(that.wxMchId) : that.wxMchId != null) return false;
        if (accessToken != null ? !accessToken.equals(that.accessToken) : that.accessToken != null) return false;
        if (refreshToken != null ? !refreshToken.equals(that.refreshToken) : that.refreshToken != null) return false;
        if (certLocalPath != null ? !certLocalPath.equals(that.certLocalPath) : that.certLocalPath != null) return false;
        if (certPassword != null ? !certPassword.equals(that.certPassword) : that.certPassword != null) return false;

        return true;
    }
    @Basic
    @Column(name = "jsp_ticket", nullable = true, length = 255)
    public String getJspTicket() {
        return jspTicket;
    }

    public void setJspTicket(String jspTicket) {
        this.jspTicket = jspTicket;
    }
    @Basic
    @Column(name = "refresh_date")
    public Date getRefreshDate() {
        return refreshDate;
    }

    public void setRefreshDate(Date refreshDate) {
        this.refreshDate = refreshDate;
    }

    @Override
    public int hashCode() {
        int result = appid != null ? appid.hashCode() : 0;
        result = 31 * result + (appSecret != null ? appSecret.hashCode() : 0);
        result = 31 * result + (wxMchId != null ? wxMchId.hashCode() : 0);
        result = 31 * result + (wxPayKey != null ? wxPayKey.hashCode() : 0);
        result = 31 * result + (accessToken != null ? accessToken.hashCode() : 0);
        result = 31 * result + (refreshToken != null ? refreshToken.hashCode() : 0);
        result = 31 * result + (jspTicket != null ? jspTicket.hashCode() : 0);
        result = 31 * result + (refreshDate != null ? refreshDate.hashCode() : 0);
        result = 31 * result + (certPassword != null ? certPassword.hashCode() : 0);
        result = 31 * result + (certLocalPath != null ? certLocalPath.hashCode() : 0);
        return result;
    }
}
